package com.ues21.awt.view;
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.event.*;

import com.ues21.awt.controller.Controlador;
import com.ues21.awt.controller.ParametrosAccion;

public class AgCli extends JInternalFrame{
	private JTextField tnumCli = null;	
	private JTextField tdomicilio = null;
	private JTextField tuser = null;
	private JTextField tpass = null;
	
	public AgCli(){
		
		super("Agregar Cliente", true, true, true,true);
		
		this.getContentPane().setLayout(null);
		
		JLabel lnumCli = new JLabel("Numero de Cliente");
		lnumCli.setBounds(20,30,120,25);
		this.getContentPane().add(lnumCli);
		
		tnumCli = new JTextField();
		tnumCli.setBounds(20, 60, 120, 20);
		this.getContentPane().add(tnumCli);
		
		JLabel ldom = new JLabel("Domicilio");
		ldom.setBounds(20, 90, 120, 25);
		this.getContentPane().add(ldom);
		
		tdomicilio = new JTextField();
		tdomicilio.setBounds(20, 120, 120, 20);
		this.getContentPane().add(tdomicilio);
		
		JLabel lUser = new JLabel ("Usuario");
		lUser.setBounds(20, 150,120, 25);
		this.getContentPane().add(lUser);
		
		tuser = new JTextField();
		tuser.setBounds(20, 180, 120, 20);
		this.getContentPane().add(tuser);
		
		JLabel lPass = new JLabel ("Password");
		lPass.setBounds(20, 210,120, 25);
		this.getContentPane().add(lPass);
		
		tpass = new JTextField();
		tpass.setBounds(20, 230, 120, 20);		
		this.getContentPane().add(tpass);
				
		JButton b = new JButton("Cargar");
		b.setBounds(20, 270, 120, 20);
		b.addActionListener(new ActionListener(){	 
			public void actionPerformed(ActionEvent e){
				//agregar
				doCli();
			}			
		});
		
		this.getContentPane().add(b);	
		
		this.setSize(400,400);
	}
	private void doCli() {
		ParametrosAccion params = new ParametrosAccion();		
		params.add("agcli", this);		
		params.add("numcli", tnumCli.getText());				
		params.add("domicilio", tdomicilio.getText());
		params.add("usuario", tuser.getText());
		params.add("password", tpass.getText());		
		Controlador.callAction("guarcli", params);
	}


}
